import java.util.List;

/**
 * @USER: Administrator
 * @DATE: 2024/9/22 上午8:47
 * @VERSION: 1.0.0
 */
public class LC3248 {
    public static void main(String[] args) {

    }

    public int finalPositionOfSnake(int n, List<String> commands) {
        final String UP="UP";
        final String DOWN="DOWN";
        final String LEFT="LEFT";
        final String RIGHT="RIGHT";
        int row=0,col=0;
        for (int i = 0; i < commands.size(); i++) {
            switch (commands.get(i)) {
                case UP:
                    row--;
                    break;
                case DOWN:
                    row++;
                    break;
                case LEFT:
                    col--;
                    break;
                case RIGHT:
                    col++;
                    break;
                default:
            }
        }
        return n*row+col;
    }

}
